// @ts-ignore

 
import { api } from '@/utils/api';

/** 计算上月绩效 POST /proPerformance/calculatePerformance */
export async function proPerformanceCalculatePerformance(
  options?: ArgumentsType<typeof api>[1]
): Promise<BIZAPI.IResultVoid>;

export async function proPerformanceCalculatePerformance(
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BIZAPI.IResultVoid>>;

export async function proPerformanceCalculatePerformance(
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BIZAPI.IResultVoid>;

export async function proPerformanceCalculatePerformance(options?: ArgumentsType<typeof api>[1]) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BIZAPI.IResultVoid>(`/app/proPerformance/calculatePerformance`, {
      method: 'POST',
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BIZAPI.IResultVoid>(`/app/proPerformance/calculatePerformance`, {
    method: 'POST',
    ...(options || {})
  });
}

/** 获取生产-绩效分页数据 POST /proPerformance/page */
export async function proPerformancePage(
  body: BIZAPI.ProPerformanceQuery,
  options?: ArgumentsType<typeof api>[1]
): Promise<BIZAPI.IResultIPageProPerformanceEntity>;

export async function proPerformancePage(
  body: BIZAPI.ProPerformanceQuery,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BIZAPI.IResultIPageProPerformanceEntity>>;

export async function proPerformancePage(
  body: BIZAPI.ProPerformanceQuery,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BIZAPI.IResultIPageProPerformanceEntity>;

export async function proPerformancePage(
  body: BIZAPI.ProPerformanceQuery,
  options?: ArgumentsType<typeof api>[1]
) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BIZAPI.IResultIPageProPerformanceEntity>(`/app/proPerformance/page`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BIZAPI.IResultIPageProPerformanceEntity>(`/app/proPerformance/page`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}

/** 更新绩效 POST /proPerformance/update */
export async function proPerformanceUpdate(
  body: BIZAPI.ProPerformanceBooleanParam,
  options?: ArgumentsType<typeof api>[1]
): Promise<BIZAPI.IResultVoid>;

export async function proPerformanceUpdate(
  body: BIZAPI.ProPerformanceBooleanParam,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BIZAPI.IResultVoid>>;

export async function proPerformanceUpdate(
  body: BIZAPI.ProPerformanceBooleanParam,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BIZAPI.IResultVoid>;

export async function proPerformanceUpdate(
  body: BIZAPI.ProPerformanceBooleanParam,
  options?: ArgumentsType<typeof api>[1]
) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BIZAPI.IResultVoid>(`/app/proPerformance/update`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BIZAPI.IResultVoid>(`/app/proPerformance/update`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}
